// $codepro.audit.disable numericLiterals, variableShouldBeFinal
/* Copyright (c) 2011 Team A CS2340. All rights reserved.*/

/**
 * Make an user interface for doctor and nurse
 * 
 * @author Bruce
 * @version 1.0
 */
package edu.gatech.teama.doctorsoffice.client.view;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JPanel;
import javax.swing.JLabel;
import java.awt.BorderLayout;
import java.awt.Dimension;

import javax.swing.JButton;

import javax.swing.SwingConstants;


import edu.gatech.teama.doctorsoffice.client.presenter.SystemAdminMainPresenter;

import java.awt.Font;
import net.miginfocom.swing.MigLayout;
import javax.swing.border.SoftBevelBorder;
import javax.swing.border.BevelBorder;

/**
 * SystemAdminPanel.java
 * @author unknown
 * @version 1.0
 */
public class SystemAdminMainPanel extends JPanel {
	/**
	 * myPresenter
	 */
	private SystemAdminMainPresenter myPresenter;

	/**
	 * btnLogOut
	 */
	private JButton btnLogOut;

	/**
	 * panel
	 */
	private JPanel panel;

	/**
	 * panel_1
	 */
	private JPanel panel_1;

	/**
	 * panel_2
	 */
	private JPanel panel_2;

	/**
	 * panel_3
	 */
	private JPanel panel_3;

	/**
	 * Create the panel.
	 */
	public SystemAdminMainPanel() { // $codepro.audit.disable com.instantiations.assist.eclipse.analysis.audit.rule.effectivejava.constructorsOnlyInvokeFinalMethods
		
		myPresenter= new SystemAdminMainPresenter();
		if(myPresenter.getUser() == null){
			System.out.println("no user is loged in");
			System.exit(0);
		}
		setLayout(new BorderLayout(0, 0));
		JLabel lblSystemAdministrator = new JLabel("System Administrator");
		lblSystemAdministrator.setFont(new Font("Tahoma", Font.PLAIN, 16));
		lblSystemAdministrator.setHorizontalAlignment(SwingConstants.CENTER);
		add(lblSystemAdministrator, BorderLayout.NORTH);
		
		panel = new JPanel();
		add(panel, BorderLayout.CENTER);
		panel.setLayout(new MigLayout("", "[grow][300px]", "[grow]"));
		
		panel_2 = new UserLookupPanel();
		panel_2.setBorder(
				new SoftBevelBorder(BevelBorder.LOWERED, null, null, null, null));
		panel.add(panel_2, "cell 0 0,grow");
		
		panel_3 = new AppointmentLookupPanel();
		panel_3.setBorder(
				new SoftBevelBorder(BevelBorder.LOWERED, null, null, null, null));
		panel.add(panel_3, "cell 1 0,grow");
		
		panel_1 = new JPanel();
		add(panel_1, BorderLayout.SOUTH);
		
		btnLogOut = new JButton("Log Out");
		panel_1.add(btnLogOut);
		btnLogOut.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				myPresenter.logOut();
			}
		});
		
		this.setMinimumSize(new Dimension(1024, 600));


	}

}
